package utils;

public class TimeIntervalle {
	public long beginTime;
	public long endTime;
	
	public TimeIntervalle(long beginTime, long endTime)
	{
		this.beginTime = beginTime;
		this.endTime = endTime;
	}
	
	@Override 
	public boolean equals(Object o)
	{
		TimeIntervalle t2 = (TimeIntervalle)o;
		return (this.beginTime == t2.beginTime && this.endTime == t2.endTime);
	}
	
	public boolean include(long time)
	{
		return ((time >= beginTime) && (time <= endTime));
	}
	
	public boolean contains(TimeIntervalle intervalle)
	{
		return ((intervalle.beginTime <= intervalle.endTime) && (intervalle.beginTime >= this.beginTime) && (intervalle.endTime <= this.endTime));
	}
	
	@Override
	public String toString()
	{
		return "[beginTime: " + beginTime + "; endTime: " + endTime+"]";
	}
}
